import { defineStore } from 'pinia'
import { ref } from 'vue'

// 用户模块
export const useUserStore = defineStore(
  'user',
  () => {
    const user = ref({})

    //清空用户仓库的方法... 明天完成 退出.
    const removeUser = () => (user.value = {})

    const setUser = ($user) => (user.value = $user)

    return {
      user,
      setUser,
      removeUser
    }
  },
  {
    persist: true
  }
)
